package com.xinsoft.entity.dto;

import cn.hutool.core.util.ObjectUtil;
import com.xinsoft.entity.vo.ErpPurchaseDetailVO;
import com.xinsoft.entity.vo.ErpSaleDetailVO;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 销售订单
 * */
@Data
public class KisSaleBodyDto {


    private Integer FEntryID;         //: 1,				子表行号
    private Integer FInterID;         //: 8032,			主表主键
    private Integer FItemID;         //: 12092,			产品代码
    private Integer FUnitID;         //: 1413,			单位
    private BigDecimal FAuxQty;         //: 10.0000000000,		数量
    private BigDecimal FQty;         //: 10.0000000000,		基本单位数量
    private BigDecimal FAuxCommitQty;         //: 0.0000000000,	关联数量
    private BigDecimal FCommitQty;         //: 0.0000000000,	基本单位关联数量
    private BigDecimal FAuxStockQty;         //: 0.0000000000,		出库数量
    private BigDecimal FStockQtyOnlyForShow;         //: 0.0000000000,	基本单位出库数量
    private String FAdviceConsignDate;         //: 9/8/2023 12:00:00 AM, 建议交货日期

    public ErpSaleDetailVO voToPo(KisSaleBodyDto item) {
        if (item == null) {
            return null;
        }
        ErpSaleDetailVO erpSaleDetailVO = new ErpSaleDetailVO();
        erpSaleDetailVO.setId(item.getFEntryID());
        erpSaleDetailVO.setHeadId(item.getFInterID());
        erpSaleDetailVO.setMaterialId(item.getFItemID());
        erpSaleDetailVO.setMainUnitId(item.getFUnitID());
        erpSaleDetailVO.setAuxNum(item.getFAuxQty().stripTrailingZeros());
        erpSaleDetailVO.setNum(item.getFQty());
        erpSaleDetailVO.setCommitAuxNum(item.getFAuxCommitQty());
        erpSaleDetailVO.setCommitAuxNum(item.getFCommitQty());
        erpSaleDetailVO.setOutAuxNum(item.getFAuxStockQty().stripTrailingZeros());
        erpSaleDetailVO.setOutNum(item.getFStockQtyOnlyForShow().stripTrailingZeros());
        erpSaleDetailVO.setAdviceConsignDate(item.getFAdviceConsignDate());
        return erpSaleDetailVO;
    }


//    {
//          FInterID: 8032,			主表主键
//          FEntryID: 1,				子表行号
//          FItemID: 12092,			产品代码
//          FQty: 10.0000000000,		基本单位数量
//          FCommitQty: 0.0000000000,	基本单位关联数量
//          FUnitID: 1413,			单位
//          FAuxCommitQty: 0.0000000000,	关联数量
//          FAuxQty: 10.0000000000,		数量
//          FAuxStockQty: 0.0000000000,		出库数量
//          FAdviceConsignDate: 9/8/2023 12:00:00 AM, 建议交货日期
//          FMapNumber: 2004 52056,			对应代码
//          FMapName: 2004 52056,				对应名称
//          FSecQty: 0.0000000000,			辅助数量
//          FSecCommitQty: 0.0000000000,		辅助单位关联数量
//          FSourceBillNo: ,					源单单号
//          FAuxCommitInstall: 0.0000000000,		组装数量
//          FSecStockQty: 0.0000000000,		辅助单位出库数量
//          FStockQtyOnlyForShow: 0.0000000000,	基本单位出库数量
//          FMrpTime: 9/11/2023 9:13:04 AM,		MRP最后计算时间
//          FPrice: 10.0000000000,
//          FAmount: 100.00,
//          FBrNO: 0,
//          FTaxRate: 0.0000000000,
//          FTaxAmount: 0.00,
//          FTax: 0.00,
//          FDiscount: ,
//          FNote: ,
//          FDate: 9/8/2023 12:00:00 AM,
//          FDiscountAmount: ,
//          FInvoiceQty: 0.0000000000,
//          FBCommitQty: 0.0000000000,
//          FTranLeadTime: 0,
//          FATPDeduct: 0,
//          FCostObjectID: 0,
//          FAuxBCommitQty: 0.0000000000,
//          FAuxInvoiceQty: 0.0000000000,
//          FAuxPrice: 10.0000000000,
//          FUniDiscount: 0.0000000000,
//          FFinalAmount: 0.00,
//          FSourceEntryID: 0,
//          FHaveMrp: 1,
//          FStockQty: 0.0000000000,
//          FBatchNo: ,
//          FCESS: 0.00,
//          FBomInterID: 0,
//          FLockFlag: 0,
//          FInForeCast: 0,
//          FAllAmount: 100.0000,
//          FAllStdAmount: 721.5700,
//          FAuxPropID: 0,
//          FAuxPriceDiscount: 10.0000000000,
//          FPriceDiscount: 10.0000000000,
//          FQtyInvoice: 0.0000000000,
//          FQtyInvoiceBase: 0.0000000000,
//          FTaxAmt: 0.0000,
//          FAuxTaxPrice: 10.0000000000,
//          FTaxPrice: 10.0000000000,
//          FReceiveAmountFor_Commit: 0.0000,
//          FReceiveAmount_Commit: 0.0000,
//          FSecCoefficient: 0.0000000000,
//          FSourceTranType: 0,
//          FSourceInterId: 0,
//          FContractInterID: 0,
//          FContractEntryID: 0,
//          FContractBillNo: ,
//          FMRPLockFlag: 0,
//          FMRPTrackFlag: 0,
//          FOrderCommitQty: 0.0000000000000,
//          FOrderSecCommitQty: 0.0000000000000,
//          FAuxQtyInvoice: 0.0000000000,
//          FCommitInstall: 0.0000000000,
//          FMrpClosed: 0,
//          FAuxInCommitQty: 0.0000000000,
//          FInCommitQty: 0.0000000000,
//          FSecInCommitQty: 0.0000000000,
//          FApplyCommitQty: 0.0000000000,
//          FAuxApplyCommitQty: 0.0000000000,
//          FSecApplyCommitQty: 0.0000000000,
//          FEvaluated: 0,
//          FPackUnitID: 0,
//          FPackCount: 0,
//          FPackType: 0.0000000000,
//          FDetailID: 64464,
//          FMapID: 0,
//          FGoodsDesc: ,
//          FAmountAfterDiscount: 0.0000,
//          FInformCommitQty: 0.0000000000,
//          FAuxInformCommitQty: 0.0000000000,
//          FSecInformCommitQty: 0.0000000000,
//          FPurCommitQty: 0.0000000000,
//          FAuxPurCommitQty: 0.0000000000,
//          FSecPurCommitQty: 0.0000000000,
//          FMrpAutoClosed: 1,
//          FSecInvoiceQty: 0.0000000000,
//          FSecCommitInstall: 0.0000000000,
//          FPlanMode: 14036,
//          FMTONo: ,
//          FOrderBillNo: ,
//          FOrderEntryID: 0,
//          FICPrcPly_FName: ,
//          FComplexQty: 10PCS,
//          FBarCode: ,
//          FBuyerFreight: 0.0000000000,
//          FIsGift: 0,
//          FIsExchangePoint: 0,
//          FExchangePoints: 0.0000000000,
//          FTplEStatus: ,
//          FTplEFail: ,
//          FTplEflat: ,
//          FTplEStock: ,
//          FGroupID: ,
//          FParentID: ,
//          FTplExtendKey1: ,
//          FEntrySelfS0172: ,
//          FEntrySelfS0173: 744546-550-85890-550-CIAL-14
//    }
}
